package foodmaterial.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class PasswordUtil {

    public static String encodePassword(String password) {
        BCryptPasswordEncoder p = new BCryptPasswordEncoder() ;
        return  p.encode(password) ;
    }

    public static boolean matches(String rawPassword,String encodePassword) {
        BCryptPasswordEncoder p = new BCryptPasswordEncoder() ;
        return p.matches(rawPassword,encodePassword) ;
    }

    public static void main(String[] args) {
        System.out.println(matches("123456","$2a$10$Jg0XyqcbGllx5ZKj3yUouu4bC.3R6oYT0eHRh69ffwtVn2oTPcu92"));
    }
}
